home *** CD-ROM | disk | FTP | other *** search
/ Freelog 70 / Freelog070.iso / Internet / EasyPHP / easyphp1-8_setup.exe / {app} / phpmyadmin / tbl_properties.inc.php < prev    next >
Encoding:
PHP Script  |  2005-01-07  |  27.3 KB  |  680 lines

  1. <?php
  2. /* $Id: tbl_properties.inc.php,v 2.18 2005/01/07 11:48:44 nijel Exp $ */
  3. // vim: expandtab sw=4 ts=4 sts=4:
  4.  
  5. // Check parameters
  6. require_once('./libraries/common.lib.php');
  7. PMA_checkParameters(array('db','table','action','num_fields'));
  8.  
  9.  
  10. // Get available character sets
  11. require_once('./libraries/mysql_charsets.lib.php');
  12.  
  13. ?>
  14. <?php if ($cfg['CtrlArrowsMoving']) { ?>
  15. <!-- Set on key handler for moving using by Ctrl+arrows -->
  16. <script src="libraries/keyhandler.js" type="text/javascript" language="javascript"></script>
  17. <script type="text/javascript" language="javascript">
  18. <!--
  19. var switch_movement = <?php echo $cfg['DefaultPropDisplay'] == 'horizontal' ? '0' : '1'; ?>;
  20. document.onkeydown = onKeyDownArrowsHandler;
  21. // -->
  22. </script>
  23. <?php } ?>
  24.  
  25. <form method="post" action="<?php echo $action; ?>" onsubmit="return checkTableEditForm(this, <?php echo $num_fields; ?>)" >
  26. <?php
  27. echo PMA_generate_common_hidden_inputs($db, $table);
  28. if ($action == 'tbl_create.php') {
  29.     ?>
  30.     <input type="hidden" name="reload" value="1" />
  31.     <?php
  32. }
  33. else if ($action == 'tbl_addfield.php') {
  34.     echo "\n";
  35.     ?>
  36.     <input type="hidden" name="field_where" value="<?php echo $field_where; ?>" />
  37.     <input type="hidden" name="after_field" value="<?php echo $after_field; ?>" />
  38.     <?php
  39. }
  40. echo "\n";
  41.  
  42. if (isset($num_fields)) {
  43.     ?>
  44.     <input type="hidden" name="orig_num_fields" value="<?php echo $num_fields; ?>" />
  45.     <?php
  46. }
  47.  
  48. if (isset($field_where)) {
  49.     ?>
  50.     <input type="hidden" name="orig_field_where" value="<?php echo $field_where; ?>" />
  51.     <?php
  52. }
  53.  
  54. if (isset($after_field)) {
  55.     ?>
  56.     <input type="hidden" name="orig_after_field" value="<?php echo $after_field; ?>" />
  57.     <?php
  58. }
  59.  
  60. if (isset($selected) && is_array($selected)) {
  61.     foreach ($selected AS $o_fld_nr => $o_fld_val) {
  62.     ?>
  63.     <input type="hidden" name="selected[<?php echo $o_fld_nr; ?>]" value="<?php echo urlencode($o_fld_val); ?>" />
  64.     <?php
  65.         if (!isset($true_selected)) {
  66.             ?>
  67.     <input type="hidden" name="true_selected[<?php echo $o_fld_nr; ?>]" value="<?php echo urlencode($o_fld_val); ?>" />
  68.             <?php
  69.         }
  70.  
  71.     }
  72.  
  73.     if (isset($true_selected) && is_array($true_selected)) {
  74.         foreach ($true_selected AS $o_fld_nr => $o_fld_val) {
  75.         ?>
  76.         <input type="hidden" name="true_selected[<?php echo $o_fld_nr; ?>]" value="<?php echo urlencode($o_fld_val); ?>" />
  77.         <?php
  78.         }
  79.     }
  80.  
  81. } elseif (isset($field)) {
  82.     ?>
  83.     <input type="hidden" name="orig_field" value="<?php echo urlencode($field); ?>" />
  84.     <input type="hidden" name="true_selected[] value="<?php echo (isset($orig_field) ? $orig_field : urlencode($field)); ?>" />
  85.     <?php
  86. }
  87.  
  88. $is_backup = ($action != 'tbl_create.php' && $action != 'tbl_addfield.php');
  89.  
  90. $header_cells = array();
  91. $content_cells = array();
  92.  
  93. $header_cells[] = $strField;
  94. $header_cells[] = $strType . ($GLOBALS['cfg']['ReplaceHelpImg'] ? PMA_showMySQLDocu('Reference', 'Column_types') : '<br /><span style="font-weight: normal">' . PMA_showMySQLDocu('Reference', 'Column_types') . '</span>');
  95. $header_cells[] = $strLengthSet;
  96. if (PMA_MYSQL_INT_VERSION >= 40100) {
  97.     $header_cells[] = $strCollation;
  98. }
  99. $header_cells[] = $strAttr;
  100. $header_cells[] = $strNull;
  101. $header_cells[] = $strDefault . '**';
  102. $header_cells[] = $strExtra;
  103.  
  104.  
  105.  
  106. // lem9: We could remove this 'if' and let the key information be shown and
  107. // editable. However, for this to work, tbl_alter must be modified to use the
  108. // key fields, as tbl_addfield does.
  109.  
  110. if (!$is_backup) {
  111.     $header_cells[] = $cfg['PropertiesIconic'] ? '<img src="' . $pmaThemeImage . 'b_primary.png" width="16" height="16" alt="' . $strPrimary . '" title="' . $strPrimary . '" />' : $strPrimary;
  112.     $header_cells[] = $cfg['PropertiesIconic'] ? '<img src="' . $pmaThemeImage . 'b_index.png" width="16" height="16" alt="' . $strIndex . '" title="' . $strIndex . '" />' : $strIndex;
  113.     $header_cells[] = $cfg['PropertiesIconic'] ? '<img src="' . $pmaThemeImage . 'b_unique.png" width="16" height="16" alt="' . $strUnique . '" title="' . $strUnique . '" />' : $strUnique;
  114.     $header_cells[] = '---';
  115.     $header_cells[] = $cfg['PropertiesIconic'] ? '<img src="' . $pmaThemeImage . 'b_ftext.png" width="16" height="16" alt="' . $strIdxFulltext . '" title="' . $strIdxFulltext . '" />' : $strIdxFulltext;
  116. }
  117.  
  118.  
  119. require_once('./libraries/relation.lib.php');
  120. require_once('./libraries/transformations.lib.php');
  121. $cfgRelation = PMA_getRelationsParam();
  122.  
  123. $comments_map = array();
  124. $mime_map = array();
  125. $available_mime = array();
  126.  
  127. if ($cfgRelation['commwork']) {
  128.     $comments_map = PMA_getComments($db, $table);
  129.     $header_cells[] = $strComments;
  130.  
  131.     if ($cfgRelation['mimework'] && $cfg['BrowseMIME']) {
  132.         $mime_map = PMA_getMIME($db, $table);
  133.         $available_mime = PMA_getAvailableMIMEtypes();
  134.  
  135.         $header_cells[] = $strMIME_MIMEtype;
  136.         $header_cells[] = $strMIME_transformation;
  137.         $header_cells[] = $strMIME_transformation_options . '***';
  138.     }
  139. }
  140.  
  141. // garvin: workaround for field_fulltext, because its submitted indizes contain
  142. //         the index as a value, not a key. Inserted here for easier maintaineance
  143. //         and less code to change in existing files.
  144. if (isset($field_fulltext) && is_array($field_fulltext)) {
  145.     foreach ($field_fulltext AS $fulltext_nr => $fulltext_indexkey) {
  146.         $submit_fulltext[$fulltext_indexkey] = $fulltext_indexkey;
  147.     }
  148. }
  149.  
  150. for ($i = 0 ; $i < $num_fields; $i++) {
  151.     $submit_null = FALSE;
  152.     if (isset($regenerate) && $regenerate == TRUE) {
  153.         // An error happened with previous inputs, so we will restore the data
  154.         // to embed it once again in this form.
  155.  
  156.         $row['Field']     = (isset($field_name) && isset($field_name[$i]) ? $field_name[$i] : FALSE);
  157.         $row['Type']      = (isset($field_type) && isset($field_type[$i]) ? $field_type[$i] : FALSE);
  158.         $row['Null']      = (isset($field_null) && isset($field_null[$i]) ? $field_null[$i] : '');
  159.         if (isset($field_type[$i]) && $row['Null'] == '') {
  160.             $submit_null = TRUE;
  161.         }
  162.  
  163.         if (isset(${'field_key_' . $i}) && ${'field_key_' . $i} == 'primary_' . $i) {
  164.             $row['Key'] = 'PRI';
  165.         } elseif (isset(${'field_key_' . $i}) && ${'field_key_' . $i} == 'index_' . $i) {
  166.             $row['Key'] = 'MUL';
  167.         } elseif (isset(${'field_key_' . $i}) && ${'field_key_' . $i} == 'unique_' . $i) {
  168.             $row['Key'] = 'UNI';
  169.         } else {
  170.             $row['Key'] = '';
  171.         }
  172.  
  173.         $row['Default']   = (isset($field_default) && isset($field_default[$i]) ? $field_default[$i] : FALSE);
  174.         $row['Extra']     = (isset($field_extra) && isset($field_extra[$i]) ? $field_extra[$i] : FALSE);
  175.         $row['Comment']   = (isset($submit_fulltext) && isset($submit_fulltext[$i]) && ($submit_fulltext[$i] == $i) ? 'FULLTEXT' : FALSE);
  176.  
  177.         $submit_length    = (isset($field_length) && isset($field_length[$i]) ? $field_length[$i] : FALSE);
  178.         $submit_attribute = (isset($field_attribute) && isset($field_attribute[$i]) ? $field_attribute[$i] : FALSE);
  179.  
  180.         if (isset($field_comments) && isset($field_comments[$i])) {
  181.             $comments_map[$row['Field']] = $field_comments[$i];
  182.         }
  183.  
  184.         if (isset($field_mimetype) && isset($field_mimetype[$i])) {
  185.             $mime_map[$row['Field']]['mimetype'] = $field_mimetype[$i];
  186.         }
  187.  
  188.         if (isset($field_transformation) && isset($field_transformation[$i])) {
  189.             $mime_map[$row['Field']]['transformation'] = $field_transformation[$i];
  190.         }
  191.  
  192.         if (isset($field_transformation_options) && isset($field_transformation_options[$i])) {
  193.             $mime_map[$row['Field']]['transformation_options'] = $field_transformation_options[$i];
  194.         }
  195.  
  196.     } elseif (isset($fields_meta)) {
  197.         $row = $fields_meta[$i];
  198.     }
  199.  
  200.     $bgcolor = ($i % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
  201.  
  202.     // Cell index: If certain fields get left out, the counter shouldn't chage.
  203.     $ci = 0;
  204.     // Everytime a cell shall be left out the STRG-jumping feature, $ci_offset
  205.     // has to be incremented ($ci_offset++)
  206.     $ci_offset = -1;
  207.  
  208.     if ($is_backup) {
  209.         $backup_field = (isset($true_selected) && $true_selected[$i] ? $true_selected[$i] : (isset($row) && isset($row['Field']) ? urlencode($row['Field']) : ''));
  210.         $content_cells[$i][$ci] = "\n" . '<input type="hidden" name="field_orig[]" value="' . $backup_field . '" />' . "\n";
  211.     } else {
  212.         $content_cells[$i][$ci] = '';
  213.     }
  214.  
  215.     $content_cells[$i][$ci] .= "\n" . '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '" type="text" name="field_name[]" size="10" maxlength="64" value="' . (isset($row) && isset($row['Field']) ? str_replace('"', '"', $row['Field']) : '') . '" class="textfield" title="' . $strField . '" />';
  216.     $ci++;
  217.     $content_cells[$i][$ci] = '<select name="field_type[]" id="field_' . $i . '_' . ($ci - $ci_offset) . '">' . "\n";
  218.  
  219.     if (empty($row['Type'])) {
  220.         $row['Type'] = '';
  221.         $type        = '';
  222.     }
  223.     else {
  224.         $type        = $row['Type'];
  225.     }
  226.     // set or enum types: slashes single quotes inside options
  227.     if (preg_match('@^(set|enum)\((.+)\)$@i', $type, $tmp)) {
  228.         $type   = $tmp[1];
  229.         $length = substr(preg_replace('@([^,])\'\'@', '\\1\\\'', ',' . $tmp[2]), 1);
  230.     } else {
  231.         // strip the "BINARY" attribute, except if we find "BINARY(" because
  232.         // this would be a BINARY or VARBINARY field type
  233.         $type   = preg_replace('@BINARY([^\(])@i', '', $type);
  234.         $type   = preg_replace('@ZEROFILL@i', '', $type);
  235.         $type   = preg_replace('@UNSIGNED@i', '', $type);
  236.  
  237.         if (strpos($type, '(')) {
  238.             $length = chop(substr($type, (strpos($type, '(') + 1), (strpos($type, ')') - strpos($type, '(') - 1)));
  239.             $type = chop(substr($type, 0, strpos($type, '(')));
  240.         } else {
  241.             $length = '';
  242.         }
  243.     } // end if else
  244.  
  245.     // some types, for example longtext, are reported as
  246.     // "longtext character set latin7" when their charset and / or collation
  247.     // differs from the ones of the corresponding database.
  248.     if (PMA_MYSQL_INT_VERSION >= 40100) {
  249.         $tmp = strpos($type, 'character set');
  250.         if ($tmp) {
  251.             $type = substr($type, 0, $tmp-1);
  252.         }
  253.     }
  254.  
  255.     if (isset($submit_length) && $submit_length != FALSE) {
  256.         $length = $submit_length;
  257.     }
  258.  
  259.     $cnt_column_types = count($cfg['ColumnTypes']);
  260.     for ($j = 0; $j < $cnt_column_types; $j++) {
  261.         $content_cells[$i][$ci] .= '                <option value="'. $cfg['ColumnTypes'][$j] . '"';
  262.         if (strtoupper($type) == strtoupper($cfg['ColumnTypes'][$j])) {
  263.             $content_cells[$i][$ci] .= ' selected="selected"';
  264.         }
  265.         $content_cells[$i][$ci] .= '>' . $cfg['ColumnTypes'][$j] . '</option>' . "\n";
  266.     } // end for
  267.  
  268.     $content_cells[$i][$ci] .= '    </select>';
  269.     $ci++;
  270.  
  271.     if ($is_backup) {
  272.         $content_cells[$i][$ci] = "\n" . '<input type="hidden" name="field_length_orig[]" value="' . urlencode($length) . '" />';
  273.     } else {
  274.         $content_cells[$i][$ci] = '';
  275.     }
  276.  
  277.     $content_cells[$i][$ci] .= "\n" . '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '" type="text" name="field_length[]" size="8" value="' . str_replace('"', '"', $length) . '" class="textfield" />' . "\n";
  278.     $ci++;
  279.  
  280.     if (preg_match('@^(set|enum)$@i', $type)) {
  281.         $binary           = 0;
  282.         $unsigned         = 0;
  283.         $zerofill         = 0;
  284.     } else {
  285.         if (!preg_match('@BINARY[\(]@i', $row['Type']) && PMA_MYSQL_INT_VERSION < 40100) {
  286.             $binary           = stristr($row['Type'], 'binary');
  287.         } else {
  288.             $binary           = FALSE;
  289.         }
  290.         $unsigned         = stristr($row['Type'], 'unsigned');
  291.         $zerofill         = stristr($row['Type'], 'zerofill');
  292.     }
  293.  
  294.     if (PMA_MYSQL_INT_VERSION >= 40100) {
  295.         $tmp_collation          = empty($row['Collation']) ? NULL : $row['Collation'];
  296.         $content_cells[$i][$ci] = PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'field_collation[]', 'field_' . $i . '_' . ($ci - $ci_offset), $tmp_collation, FALSE);
  297.         unset($tmp_collation);
  298.         $ci++;
  299.     }
  300.  
  301.     $content_cells[$i][$ci] = '<select name="field_attribute[]" id="field_' . $i . '_' . ($ci - $ci_offset) . '">' . "\n";
  302.  
  303.     $strAttribute     = '';
  304.     if ($binary) {
  305.         $strAttribute = 'BINARY';
  306.     }
  307.     if ($unsigned) {
  308.         $strAttribute = 'UNSIGNED';
  309.     }
  310.     if ($zerofill) {
  311.         $strAttribute = 'UNSIGNED ZEROFILL';
  312.     }
  313.  
  314.     if (isset($submit_attribute) && $submit_attribute != FALSE) {
  315.         $strAttribute = $submit_attribute;
  316.     }
  317.  
  318.     $cnt_attribute_types = count($cfg['AttributeTypes']);
  319.     for ($j = 0;$j < $cnt_attribute_types; $j++) {
  320.         if (PMA_MYSQL_INT_VERSION >= 40100 && $cfg['AttributeTypes'][$j] == 'BINARY') {
  321.             continue;
  322.         }
  323.         $content_cells[$i][$ci] .= '                <option value="'. $cfg['AttributeTypes'][$j] . '"';
  324.         if (strtoupper($strAttribute) == strtoupper($cfg['AttributeTypes'][$j])) {
  325.             $content_cells[$i][$ci] .= ' selected="selected"';
  326.         }
  327.         $content_cells[$i][$ci] .= '>' . $cfg['AttributeTypes'][$j] . '</option>' . "\n";
  328.     }
  329.  
  330.     $content_cells[$i][$ci] .= '</select>';
  331.     $ci++;
  332.  
  333.     $content_cells[$i][$ci] = '<select name="field_null[]" id="field_' . $i . '_' . ($ci - $ci_offset) . '">';
  334.  
  335.     if ((!isset($row) || empty($row['Null']) || $row['Null'] == 'NOT NULL') && $submit_null == FALSE) {
  336.         $content_cells[$i][$ci] .= "\n";
  337.         $content_cells[$i][$ci] .= '    <option value="NOT NULL">not null</option>' . "\n";
  338.         $content_cells[$i][$ci] .= '    <option value="">null</option>' . "\n";
  339.     } else {
  340.         $content_cells[$i][$ci] .= "\n";
  341.         $content_cells[$i][$ci] .= '    <option value="">null</option>' . "\n";
  342.         $content_cells[$i][$ci] .= '    <option value="NOT NULL">not null</option>' . "\n";
  343.     }
  344.  
  345.     $content_cells[$i][$ci] .= "\n" . '</select>';
  346.     $ci++;
  347.  
  348.     if (isset($row)
  349.         && !isset($row['Default']) && !empty($row['Null'])) {
  350.         $row['Default'] = 'NULL';
  351.     }
  352.  
  353.     if ($is_backup) {
  354.         $content_cells[$i][$ci] = "\n" . '<input type="hidden" name="field_default_orig[]" size="8" value="' . (isset($row) && isset($row['Default']) ? urlencode($row['Default']) : '') . '" />';
  355.     } else {
  356.         $content_cells[$i][$ci] = "\n";
  357.     }
  358.  
  359.     $content_cells[$i][$ci] .= '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '" type="text" name="field_default[]" size="12" value="' . (isset($row) && isset($row['Default']) ? str_replace('"', '"', $row['Default']) : '') . '" class="textfield" />';
  360.     $ci++;
  361.  
  362.     $content_cells[$i][$ci] = '<select name="field_extra[]" id="field_' . $i . '_' . ($ci - $ci_offset) . '">';
  363.  
  364.     if (!isset($row) || empty($row['Extra'])) {
  365.         $content_cells[$i][$ci] .= "\n";
  366.         $content_cells[$i][$ci] .= '<option value=""></option>' . "\n";
  367.         $content_cells[$i][$ci] .= '<option value="AUTO_INCREMENT">auto_increment</option>' . "\n";
  368.     } else {
  369.         $content_cells[$i][$ci] .= "\n";
  370.         $content_cells[$i][$ci] .= '<option value="AUTO_INCREMENT">auto_increment</option>' . "\n";
  371.         $content_cells[$i][$ci] .= '<option value=""></option>' . "\n";
  372.     }
  373.  
  374.     $content_cells[$i][$ci] .= "\n" . '</select>';
  375.     $ci++;
  376.  
  377.  
  378.     // lem9: See my other comment about removing this 'if'.
  379.     if (!$is_backup) {
  380.         if (isset($row) && isset($row['Key']) && $row['Key'] == 'PRI') {
  381.             $checked_primary = ' checked="checked"';
  382.         } else {
  383.             $checked_primary = '';
  384.         }
  385.         if (isset($row) && isset($row['Key']) && $row['Key'] == 'MUL') {
  386.             $checked_index   = ' checked="checked"';
  387.         } else {
  388.             $checked_index   = '';
  389.         }
  390.         if (isset($row) && isset($row['Key']) && $row['Key'] == 'UNI') {
  391.             $checked_unique   = ' checked="checked"';
  392.         } else {
  393.             $checked_unique   = '';
  394.         }
  395.         if (empty($checked_primary)
  396.             && empty($checked_index)
  397.             && empty($checked_unique)) {
  398.             $checked_none = ' checked="checked"';
  399.         } else {
  400.             $checked_none = '';
  401.         }
  402.  
  403.         if ((isset($row) && isset($row['Comment']) && $row['Comment'] == 'FULLTEXT')) {
  404.             $checked_fulltext = ' checked="checked"';
  405.         } else {
  406.             $checked_fulltext = '';
  407.         }
  408.  
  409.         $content_cells[$i][$ci] = "\n" . '<input type="radio" name="field_key_' . $i . '" value="primary_' . $i . '"' . $checked_primary . ' title="' . $strPrimary . '" />';
  410.         $ci++;
  411.  
  412.         $content_cells[$i][$ci] = "\n" . '<input type="radio" name="field_key_' . $i . '" value="index_' . $i . '"' .  $checked_index . ' title="' . $strIndex . '" />';
  413.         $ci++;
  414.  
  415.         $content_cells[$i][$ci] = "\n" . '<input type="radio" name="field_key_' . $i . '" value="unique_' . $i . '"' .  $checked_unique . ' title="' . $strUnique . '" />';
  416.         $ci++;
  417.  
  418.         $content_cells[$i][$ci] = "\n" . '<input type="radio" name="field_key_' . $i . '" value="none_' . $i . '"' .  $checked_none . ' title="---" />';
  419.         $ci++;
  420.  
  421.         $content_cells[$i][$ci] = '<input type="checkbox" name="field_fulltext[]" value="' . $i . '"' . $checked_fulltext . ' title="' . $strIdxFulltext . '" />';
  422.         $ci++;
  423.     } // end if ($action ==...)
  424.  
  425.     // garvin: comments
  426.     if ($cfgRelation['commwork']) {
  427.         $content_cells[$i][$ci] = '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '" type="text" name="field_comments[]" size="12" value="' . (isset($row) && isset($row['Field']) && is_array($comments_map) && isset($comments_map[$row['Field']]) ?  htmlspecialchars($comments_map[$row['Field']]) : '') . '" class="textfield" />';
  428.         $ci++;
  429.     }
  430.  
  431.     // garvin: MIME-types
  432.     if ($cfgRelation['mimework'] && $cfg['BrowseMIME'] && $cfgRelation['commwork']) {
  433.         $content_cells[$i][$ci] = '<select id="field_' . $i . '_' . ($ci - $ci_offset) . '" size="1" name="field_mimetype[]">' . "\n";
  434.         $content_cells[$i][$ci] .= '    <option value=""></option>' . "\n";
  435.         $content_cells[$i][$ci] .= '    <option value="auto">auto-detect</option>' . "\n";
  436.  
  437.         if (is_array($available_mime['mimetype'])) {
  438.             foreach ($available_mime['mimetype'] AS $mimekey => $mimetype) {
  439.                 $checked = (isset($row) && isset($row['Field']) && isset($mime_map[$row['Field']]['mimetype']) && ($mime_map[$row['Field']]['mimetype'] == str_replace('/', '_', $mimetype)) ? 'selected ' : '');
  440.                 $content_cells[$i][$ci] .= '    <option value="' . str_replace('/', '_', $mimetype) . '" ' . $checked . '>' . htmlspecialchars($mimetype) . '</option>';
  441.             }
  442.         }
  443.  
  444.         $content_cells[$i][$ci] .= '</select>';
  445.         $ci++;
  446.  
  447.         $content_cells[$i][$ci] = '<select id="field_' . $i . '_' . ($ci - $ci_offset) . '" size="1" name="field_transformation[]">' . "\n";
  448.         $content_cells[$i][$ci] .= '    <option value="" title="' . $strNone . '"></option>' . "\n";
  449.         if (is_array($available_mime['transformation'])) {
  450.             foreach ($available_mime['transformation'] AS $mimekey => $transform) {
  451.                 $checked = (isset($row) && isset($row['Field']) && isset($mime_map[$row['Field']]['transformation']) && (preg_match('@' . preg_quote($available_mime['transformation_file'][$mimekey]) . '3?@i', $mime_map[$row['Field']]['transformation'])) ? 'selected ' : '');
  452.                 $tooltip = 'strTransformation_' . strtolower(preg_replace('@(\.inc\.php3?)$@', '', $available_mime['transformation_file'][$mimekey]));
  453.                 $tooltip = isset($$tooltip) ? $$tooltip : sprintf(str_replace('<br />', ' ', $strMIME_nodescription), 'PMA_transformation_' . $tooltip . '()');
  454.                 $content_cells[$i][$ci] .= '<option value="' . $available_mime['transformation_file'][$mimekey] . '" ' . $checked . ' title="' . htmlspecialchars($tooltip) . '">' . htmlspecialchars($transform) . '</option>' . "\n";
  455.             }
  456.         }
  457.  
  458.         $content_cells[$i][$ci] .= '</select>';
  459.         $ci++;
  460.  
  461.         $content_cells[$i][$ci] = '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '" type="text" name="field_transformation_options[]" size="16" value="' . (isset($row) && isset($row['Field']) && isset($mime_map[$row['Field']]['transformation_options']) ?  htmlspecialchars($mime_map[$row['Field']]['transformation_options']) : '') . '" class="textfield" />';
  462.         //$ci++;
  463.     }
  464. } // end for
  465.  
  466. if ($cfg['DefaultPropDisplay'] == 'horizontal') {
  467. ?>
  468.     <table border="<?php echo $cfg['Border']; ?>" cellpadding="2" cellspacing="1">
  469.     <tr>
  470. <?php
  471.     if (is_array($header_cells)) {
  472.         foreach ($header_cells AS $header_nr => $header_val) {
  473. ?>
  474.         <th class="tblHeaders"><?php echo $header_val; ?></th>
  475. <?php
  476.         }
  477.     }
  478. ?>
  479.     </tr>
  480. <?php
  481.     if (is_array($content_cells)) {
  482.         $i = 0;
  483.         foreach ($content_cells AS $content_nr => $content_row) {
  484.             $i++;
  485.             echo "\n" . '<tr>' . "\n";
  486.  
  487.             $bgcolor = ($i % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
  488.  
  489.             if (is_array($content_row)) {
  490.                 foreach ($content_row AS $content_row_nr => $content_row_val) {
  491. ?>
  492.         <td bgcolor="<?php echo $bgcolor; ?>" align="center"><?php echo $content_row_val; ?></td>
  493. <?php
  494.                 }
  495.             }
  496.  
  497.             echo "\n" . '</tr>' . "\n";
  498.         }
  499.     }
  500. ?>
  501.     </table>
  502.     <br />
  503. <?php
  504. } else {
  505. ?>
  506.     <table border="<?php echo $cfg['Border']; ?>">
  507. <?php
  508.     if (is_array($header_cells)) {
  509.         $i = 0;
  510.         foreach ($header_cells AS $header_nr => $header_val) {
  511.             echo "\n" . '<tr>' . "\n";
  512. ?>
  513.         <th align="right"><?php echo $header_val; ?></th>
  514. <?php
  515.     $cnt_content_cells = count($content_cells);
  516.     for ($j = 0; $j < $cnt_content_cells; $j++) {
  517.         if (isset($content_cells[$j][$i]) && $content_cells[$j][$i] != '') {
  518.             $bgcolor = ($j % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
  519.     ?>
  520.         <td bgcolor="<?php echo $bgcolor; ?>"><?php echo $content_cells[$j][$i]; ?></td>
  521.     <?php
  522.         }
  523.     }
  524.  
  525.     echo "\n" . '</tr>' . "\n";
  526.     $i++;
  527.         }
  528.     }
  529. ?>
  530.     </table>
  531.     <br />
  532. <?php
  533. }
  534.  
  535. if ($action == 'tbl_create.php') {
  536.     echo "\n";
  537.     ?>
  538.     <table>
  539.     <tr valign="top">
  540.         <td><?php echo $strTableComments; ?>: </td>
  541.     <?php
  542.     if ($action == 'tbl_create.php') {
  543.         echo "\n";
  544.         ?>
  545.         <td width="25"> </td>
  546.         <td><?php echo $strTableType; ?>: </td>
  547.         <?php
  548.         if (PMA_MYSQL_INT_VERSION >= 40100) {
  549.             echo '        <td width="25"> </td>' . "\n"
  550.                . '        <td>' . $strCollation . ': </td>' . "\n";
  551.         }
  552.     }
  553.     echo "\n";
  554.     ?>
  555.     </tr>
  556.     <tr>
  557.         <td>
  558.             <input type="text" name="comment" size="40" maxlength="80" value="<?php echo (isset($comment) ? $comment : ''); ?>" class="textfield" />
  559.         </td>
  560.     <?php
  561.     // BEGIN - Table Type - 2 May 2001 - Robbat2
  562.     // change by staybyte - 11 June 2001
  563.     if ($action == 'tbl_create.php') {
  564.         // find mysql capability - staybyte - 11. June 2001
  565.         $result = PMA_DBI_try_query('SHOW VARIABLES LIKE \'have_%\';');
  566.         if ($result) {
  567.             while ($tmp = PMA_DBI_fetch_assoc($result)) {
  568.                 if (isset($tmp['Variable_name'])) {
  569.                     switch ($tmp['Variable_name']) {
  570.                         case 'have_bdb':
  571.                             if (isset($tmp['Variable_name']) && $tmp['Value'] == 'YES') {
  572.                                 $tbl_bdb    = TRUE;
  573.                             }
  574.                             break;
  575.                         case 'have_gemini':
  576.                             if (isset($tmp['Variable_name']) && $tmp['Value'] == 'YES') {
  577.                                 $tbl_gemini = TRUE;
  578.                             }
  579.                             break;
  580.                         case 'have_innodb':
  581.                             if (isset($tmp['Variable_name']) && $tmp['Value'] == 'YES') {
  582.                                 $tbl_innodb = TRUE;
  583.                             }
  584.                             break;
  585.                         case 'have_isam':
  586.                             if (isset($tmp['Variable_name']) && $tmp['Value'] == 'YES') {
  587.                                 $tbl_isam   = TRUE;
  588.                             }
  589.                             break;
  590.                     } // end switch
  591.                 } // end if
  592.             } // end while
  593.         } // end if
  594.         PMA_DBI_free_result($result);
  595.  
  596.         echo "\n";
  597.         ?>
  598.         <td width="25"> </td>
  599.         <td>
  600.             <select name="tbl_type">
  601.                 <option <?php echo (isset($tbl_type) && $tbl_type == 'Default' ? 'selected="checked"' : ''); ?> value="Default"><?php echo $strDefault; ?></option>
  602.                 <option <?php echo (isset($tbl_type) && $tbl_type == 'MYISAM' ? 'selected="checked"' : ''); ?> value="MYISAM">MyISAM</option>
  603.                 <option <?php echo (isset($tbl_type) && $tbl_type == 'HEAP' ? 'selected="checked"' : ''); ?> value="HEAP">Heap</option>
  604.                 <option <?php echo (isset($tbl_type) && $tbl_type == 'MERGE' ? 'selected="checked"' : ''); ?> value="MERGE">Merge</option>
  605.                 <?php if (isset($tbl_bdb)) { ?><option <?php echo (isset($tbl_type) && $tbl_type == 'BDB' ? 'selected="checked"' : ''); ?> value="BDB">Berkeley DB</option><?php } ?>
  606.                 <?php if (isset($tbl_gemini)) { ?><option <?php echo (isset($tbl_type) && $tbl_type == 'GEMINI' ? 'selected="checked"' : ''); ?> value="GEMINI">Gemini</option><?php } ?>
  607.                 <?php if (isset($tbl_innodb)) { ?><option <?php echo (isset($tbl_type) && $tbl_type == 'INNO DB' ? 'selected="checked"' : ''); ?> value="InnoDB">INNO DB</option><?php } ?>
  608.                 <?php if (isset($tbl_isam)) { ?><option <?php echo (isset($tbl_type) && $tbl_type == 'ISAM' ? 'selected="checked"' : ''); ?> value="ISAM">ISAM</option><?php } ?>
  609.             </select>
  610.         </td>
  611.         <?php
  612.         if (PMA_MYSQL_INT_VERSION >= 40100) {
  613.             echo '        <td width="25"> </td>' . "\n"
  614.                . '        <td>' . "\n"
  615.                . PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'tbl_collation', NULL, NULL, FALSE, 3)
  616.                . '        </td>' . "\n";
  617.         }
  618.     }
  619.     echo "\n";
  620.     ?>
  621.         </tr>
  622.     </table>
  623.     <br />
  624.     <?php
  625. }
  626. echo "\n";
  627. // END - Table Type - 2 May 2001 - Robbat2
  628. ?>
  629.  
  630. <?php
  631. if ($action == 'tbl_create.php' || $action == 'tbl_addfield.php') {
  632.     echo '    ' . sprintf($strAddFields,  '<input type="text" name="added_fields" size="2" value="1" onfocus="this.select()" style="vertical-align: middle;" />') . "\n";
  633.     echo '     <input type="submit" name="submit_num_fields" value="' . $strGo . '" onclick="return checkFormElementInRange(this.form, \'added_fields\', 1)" style="vertical-align: middle;" />' . "\n<br />\n<br />\n";
  634. }
  635. ?>
  636.  
  637. <div class="tblFooters" style="width: 80%; text-align: center; padding: 3px;">
  638.     <input type="submit" name="do_save_data" value="<?php echo $strSave; ?>" />
  639. </div>
  640.  
  641. </form>
  642.  
  643. <table>
  644. <tr>
  645.     <td valign="top">* </td>
  646.     <td>
  647.         <?php echo $strSetEnumVal . "\n"; ?>
  648.     </td>
  649. </tr>
  650. <tr>
  651.     <td valign="top">** </td>
  652.     <td>
  653.         <?php echo $strDefaultValueHelp . "\n"; ?>
  654.     </td>
  655. </tr>
  656.  
  657. <?php
  658. if ($cfgRelation['commwork'] && $cfgRelation['mimework'] && $cfg['BrowseMIME']) {
  659. ?>
  660. <tr>
  661.     <td valign="top" rowspan="2">*** </td>
  662.     <td>
  663.         <?php echo $strMIME_transformation_options_note  . "\n"; ?>
  664.     </td>
  665. </tr>
  666.  
  667. <tr>
  668.     <td>
  669.         <?php echo sprintf($strMIME_transformation_note, '<a href="libraries/transformations/overview.php?' . PMA_generate_common_url($db, $table) . '" target="_blank">', '</a>') . "\n"; ?>
  670.     </td>
  671. </tr>
  672. <?php
  673. }
  674. ?>
  675.  
  676. </table>
  677. <br />
  678.  
  679. <center><?php echo PMA_showMySQLDocu('Reference', 'CREATE_TABLE'); ?></center>
  680.